// 新建处的数据配置
export function newOption(valueArray, formInfo, formFun) {
    const DIC = {
        VAILD: [{
                label: "真",
                value: "true"
            },
            {
                label: "假",
                value: "false"
            }
        ],
        Msg_lenve: [{
                label: "A",
                value: "A"
            },
            {
                label: "B",
                value: "B"
            },
            {
                label: "C",
                value: "C"
            }
        ],
        SEX: [{
                label: "男",
                value: 0
            },
            {
                label: "女",
                value: 1
            }
        ],
        bool: [{
            label: "",
            value: 0
        }]
    };
    const phone = (rule, value, callback) => {
        if (!value) {
            return callback(new Error('请输入客户号码'))
        } else if (!(/^[0-9]{1,20}$/.test(value))) {
            return callback(new Error('请输入正确的客户号码'));
        } else {
            return callback();
        }
    }
    return {
        size: valueArray.sizeValue,
        labelWidth: 120,
        emptyBtn: false,
        submitBtn: false,
        enter: false,
        column: [{
                label: "客户姓名",
                prop: "clientName",
                span: 12,
                rules: [{
                    required: true,
                    message: "请输入客户姓名",
                    trigger: "blur"
                }]
            },
            {
                label: "客户电话",
                prop: "phone",
                span: 12,
                maxlength: 20,
                showWordLimit: true,
                rules: [{
                    required: true,
                    // message: "请输入客户电话",
                    validator: phone,
                    trigger: "blur"
                }]
            }, {
                label: "信息等级",
                prop: "msgGrade",
                type: "select",
                dicData: DIC.Msg_lenve,
                span: 12,
                change: ({
                    value,
                    column
                }) => {
                    formInfo[column.prop] = value;
                }
            }, {
                label: "产品型号",
                prop: "productModel",
                type: 'select',
                filterable: true,
                dicData: valueArray.productModel ? valueArray.productModel : valueArray.productModelList,
                span: 12,
                props: {
                    label: "modelCode",
                    value: "modelCode"
                },
                change: ({
                    value,
                    column
                }) => {
                    formInfo[column.prop] = value;
                    (formFun.productModelFun) ? formFun.productModelFun(value): ''
                }
            }, {
                label: "产品大类",
                prop: "productClass",
                type: "select",
                filterable: true,
                dicData: valueArray.productClass ? valueArray.productClass : valueArray.productModelList,
                span: 12,
                props: {
                    label: "classify",
                    value: "classify"
                },
                change: ({
                    value,
                    column
                }) => {
                    formInfo[column.prop] = value;
                    (formFun.productClassFun) ? formFun.productClassFun(value): ''
                }
            }, {
                label: "责任单位",
                prop: "dutyUnit",
                type: "select",
                filterable: true,
                dicData: valueArray.dutyUnit ? valueArray.dutyUnit : valueArray.productModelList,
                props: {
                    label: "companyName",
                    value: "companyID"
                },
                span: 12,
                change: ({
                    value,
                    column
                }) => {
                    formInfo[column.prop] = value;
                    (formFun.dutyUnitFun) ? formFun.dutyUnitFun(value): ""
                }
            }, {
                label: "业务来源",
                prop: "source",
                type: "select",
                dicData: valueArray.source,
                span: 12
            },
            // {
            //     prop: "outHref",
            //     formslot: true,
            //     span: 12
            // },
            {
                label: "优先级",
                prop: "priority",
                type: "select",
                dicData: valueArray.priority,
                span: 12
            },
            {
                label: "回电时间",
                prop: "subCallTime",
                type: "datetime",
                format: "yyyy-MM-dd hh:mm:ss",
                valueFormat: "timestamp",
                span: 12,
                change: ({
                    value,
                    column
                }) => {
                    formInfo[column.prop] = value;
                }
            },
            {
                label: '类型',
                prop: "workOrderTypeId",
                type: "select",
                dicData: valueArray.type,
                defaultIndex: '1',
                props: {
                    label: "name",
                    value: "id"
                },
                // disabled: true,
                rules: [{
                    required: true,
                    message: "请选择类型",
                    trigger: "change"
                }],
                span: 12,
                change: ({
                    value,
                    column
                }) => {
                    formFun.changeRegion ? formFun.changeRegion(value) : ''
                },
            },
            {
                label: "概述",
                prop: "title",
                type: "text",
                maxlength: 80,
                showWordLimit: true,
                span: 24
            },
            // {
            //     label: "业务分类一",
            //     prop: "typeOne",
            //     type: "cascader",
            //     dicData: valueArray.businessTypeList,
            //     span: 11,
            //     props: {
            //         label: 'name',
            //         value: 'code',
            //         children: "children"
            //     },
            //     change: ({
            //         value,
            //         column
            //     }) => {
            //         formInfo[column.prop] = value;
            //     }
            // },
            // {
            //     label: "",
            //     labelWidth: 0,
            //     prop: "gradeOne",
            //     span: 1,
            //     type: "checkbox",
            //     dicData: DIC.bool,
            //     change: ({
            //         value,
            //         column
            //     }) => {
            //         formInfo[column.prop] = value.length > 0 ? true : false;
            //     }
            // },

            // {
            //     label: "业务分类二",
            //     prop: "typeTwo",
            //     type: "cascader",
            //     dicData: valueArray.businessTypeList,
            //     span: 11,
            //     props: {
            //         label: 'name',
            //         value: 'code',
            //         children: "children"
            //     },
            //     change: ({
            //         value,
            //         column
            //     }) => {
            //         formInfo[column.prop] = value;
            //     }
            // },
            // {
            //     label: "",
            //     labelWidth: 0,
            //     prop: "gradeTwo",
            //     span: 1,
            //     type: "checkbox",
            //     dicData: DIC.bool,
            //     change: ({
            //         value,
            //         column
            //     }) => {
            //         formInfo[column.prop] = value.length > 0 ? true : false;
            //     }
            // },
        ]
    };
}
// 工单列表搜索部分的数据配置
export function serOption(valueArray, formInfo, filterType) {
    return {
        labelWidth: 90,
        emptyBtn: false,
        submitBtn: false,
        enter: false,
        column: [
            // {
            //   label: "客户类别",
            //   prop: "customType",
            //   type: "select",
            //   span: 6,
            //   dicData: this.customerList
            // },
            {
                label: '状态',
                prop: "workOrderStatusId",
                type: "select",
                span: 8,
                dicData: valueArray.orderStatus,
                change: ({
                    value,
                    column
                }) => {
                    formInfo[column.prop] = value;
                }
            },
            {
                label: "创建时间",
                prop: "createTime",
                format: "yyyy-MM-dd",
                type: "daterange",
                span: 10,
                change: ({
                    value,
                    column
                }) => {
                    console.log(value)
                    formInfo[column.prop] = value;
                }
            },
            // {
            //   label: "行业类型",
            //   prop: "institution",
            //   type: "cascader",
            //   span: 6,
            //   props: {
            //     label: "Name",
            //     value: "Code",
            //     list: "children"
            //   },
            //   dicData: valueArray.institutionList,
            //   change: ({ value, column }) => {
            //     console.log(value, column);
            //     formInfo[column.prop] = value;
            //   }
            // },

            {
                labelWidth: 60,
                label: "优先级",
                prop: "priority",
                type: "select",
                span: 6,
                dicData: valueArray.priorityList,
                change: ({
                    value,
                    column
                }) => {
                    formInfo[column.prop] = value;
                }
            },
            {
                label: "服务单分类",
                prop: "seviceType",
                type: "cascader",
                span: 8,
                dataType: 'string',
                display: filterType != 'order_type',
                // changeOnSelect:true,
                filterable: true,
                dicData: valueArray.seviceTypeList,
                change: ({
                    value,
                    column
                }) => {
                    formInfo[column.prop] = value;
                },
            },
            {
                label: "工单分类",
                prop: "orderType",
                type: "cascader",
                dataType: 'string',
                span: 8,
                display: filterType != 'sevice_type',
                // changeOnSelect:true,
                filterable: true,
                dicData: valueArray.orderTypeList,
                change: ({
                    value,
                    column
                }) => {
                    formInfo[column.prop] = value;
                },
            },
            {
                label: '业务来源',
                prop: "source",
                type: "select",
                span: 8,
                dicData: valueArray.sourceList,
                change: ({
                    value,
                    column
                }) => {
                    formInfo[column.prop] = value;
                }
            },
            {
                label: "客户姓名",
                prop: "clientName",
                type: "input",
                dataType: "string",
                span: 8
            },
            {
                label: "电话号码",
                prop: "phone",
                type: "tel",
                showWordLimit: true,
                span: 8
            },
            // {
            //     label: "坐席姓名/工号",
            //     prop: "createUserName",
            //     type: "input",
            //     dataType: "string",
            //     span: 8
            // },
            // {
            //     label: '内容',
            //     prop: "problemDesc",
            //     type: "input",
            //     dataType: "string",
            //     span: 8
            // },
        ]
    };
}